#猜数字游戏作为核心主干
from random inport randint
total_times=0  #总游戏次数归0
while True:
    total_times+=1
    ans=randint(1,100)
    inter_times=0   #猜的轮数归0
    while Bingo=False:
        data=input('请输入你猜的数字')
        inter_times+=1
        if data >ans:
            print('猜大了，请继续')
        if data<ans:
            print('猜小了，请继续')
        if data=ans:
            print('Bingo,你猜对了')
    rep=input('Do you want to try again?Y/N')
    if rep!=Y:
        break
        ave_times=inter_times/total_times
        print('You totally guess %d times, and used %d cycles get this right answer'%(total_times,ave_times))